import {
  BwComPropSetConstValueComEnum,
  BwCustomComPropDataTypeEnum,
  BwCustomComEmitParamDataTypeEnum,
  BwCustomComSoltTypeEnum,
} from '../../../render/models'
import type {
  BwCustomComEmitInfoModel,
  BwCustomComSlotInfoModel,
  BwCustomComPropInfoModel,
} from '../../../render/models'

/** 组件属性 */
const comAttrs: Array<BwCustomComPropInfoModel> = [
  {
    key: 'class',
    name: 'classNames',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.array,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'innerHTML',
    name: '文案',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'block',
    name: '将按钮宽度调整为其父宽度的选项',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'danger',
    name: '设置危险按钮',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'disabled',
    name: '按钮失效状态',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'ghost',
    name: '幽灵属性，使按钮背景透明',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'href',
    name: '点击跳转的地址，指定此属性 button 的行为和 a 链接一致',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'htmlType',
    name: '设置 button 原生的 type 值',
    isRequire: false,
    defaultValue: 'button',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'loading',
    name: '设置按钮载入状态',
    isRequire: false,
    defaultValue: 'false',
    dataType: [
      BwCustomComPropDataTypeEnum.boolean,
      BwCustomComPropDataTypeEnum.object,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'shape',
    name: '设置按钮形状',
    isRequire: false,
    defaultValue: 'default',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: 'default',
          value: 'default',
        },
        {
          label: 'circle',
          value: 'circle',
        },
        {
          label: 'round',
          value: 'round',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'size',
    name: '设置按钮大小',
    isRequire: false,
    defaultValue: 'middle',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '大',
          value: 'large',
        },
        {
          label: '中',
          value: 'middle',
        },
        {
          label: '小',
          value: 'small',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'target',
    name: '相当于a链接的 target 属性,href 存在时生效',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'type',
    name: '设置按钮类型',
    isRequire: false,
    defaultValue: 'default',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: 'primary',
          value: 'primary',
        },
        {
          label: 'ghost',
          value: 'ghost',
        },
        {
          label: 'dashed',
          value: 'dashed',
        },
        {
          label: 'link',
          value: 'link',
        },
        {
          label: 'text',
          value: 'text',
        },
        {
          label: 'default',
          value: 'default',
        },
      ],
    }),
    remark: '',
  },
]

/** 组件事件 */
const comEmits: Array<BwCustomComEmitInfoModel> = [
  {
    key: 'click',
    name: '点击按钮时的回调',
    params: [
      {
        paramKey: 'e',
        paramName: 'event',
        paramDataType: BwCustomComEmitParamDataTypeEnum.object,
        remark: '',
      },
    ],
  },
]

/** 组件插槽 */
const comSlots: Array<BwCustomComSlotInfoModel> = [
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'default',
      slotName: '默认插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'icon',
      slotName: '设置按钮的图标类型',
    },
  },
]

export const antButtonInfo = {
  comAttrs,
  comEmits,
  comSlots,
}
